|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A translator translates a given file into another language. The translator is also responsible to provide line mapping information for the translation and to compute which offset in an original line corresponds to a given offset in a target line.
XXX: This is work in progress and can change anytime until API for 3.0 is frozen.
Method Summary | |
int |
backTranslateOffsetInLine(String sourceLine,
String translatedLine,
int offsetInTranslatedLine,
String tag)
Computes the offset in the source line that corresponds to the given offset in the translated line. |
int[] |
getLineMapping()
Returns the line mapping information. |
void |
setTagHandlerFactory(ITagHandlerFactory tagHandlerFactory)
Assigns an optional tag handler factory to this translator. |
String |
translate(Reader reader,
String name)
Reads the source from the given reader and creates translates it into another language. |
Method Detail |
public String translate(Reader reader, String name) throws IOException
reader
- the reader to access the sourcename
- the name of the translated source or null
if none
IOException
public int[] getLineMapping()
public void setTagHandlerFactory(ITagHandlerFactory tagHandlerFactory)
A translator can delegate the handling of individual tags to tag handlers. The factory is responsible to provide the correct tag handlers.
tagHandlerFactory
- a tag handler factory or null
if this translator does all work itselfpublic int backTranslateOffsetInLine(String sourceLine, String translatedLine, int offsetInTranslatedLine, String tag)
translatedLine
- the translated lineoffsetInTranslatedLine
- the offset in the translated linetag
- the tag to which the source line belongs or
null
if the tag is not known
-1
if
it was not possible to compute the offset
|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |